#include <bits/stdc++.h>
#define F(i,l,r) for(int i=(l);i<=(r);i++)
#define DF(i,l,r) for(int i=(l);i>=(r);i--)
#define ms(x,y) memset(x,y,sizeof(x))
#define SZ(x) (int)x.size()-1
#define pb push_back
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
typedef pair<int,int> pii;
template<typename T> void chkmin(T &x,T y){ x=min(x,y);}
template<typename T> void chkmax(T &x,T y){ x=max(x,y);}
template<typename T> void read(T &x){
    x=0;int r=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') r=-1;
    for(;isdigit(ch);ch=getchar()) x=(x<<1)+(x<<3)+ch-48;
    x*=r;
}
const int N=100010;
int n,a[N];
bool chk(int mid){
    F(i,1,n-mid) if(a[i]>=a[i+mid]) return 0;
    return 1;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    read(n);
    F(i,1,n) read(a[i]);
    sort(a+1,a+n+1);
    int lo=0,hi=n+1;
    while(lo<hi-1){
        int mid=(lo+hi)>>1;
        if(chk(mid)) hi=mid;
        else lo=mid;
    }
    printf("%d\n",hi);
    return 0;
}
